import 'package:flutter/material.dart';

class BottomSheetModal extends StatefulWidget {
  const BottomSheetModal({ Key? key }) : super(key: key);

  @override
  State<BottomSheetModal> createState() => _BottomSheetModalState();
}

class _BottomSheetModalState extends State<BottomSheetModal> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('底部弹出按钮'),
      ),
      body: Center(
        child: ElevatedButton(
          child: const Text('打开底部弹窗'),
          onPressed: (){
            showModalBottomSheet(
              context: context, 
              builder: (BuildContext context){
                return SizedBox(
                  height: 400,
                  child: Center(
                    child: ElevatedButton(
                      child: const Text('关闭底部弹窗'),
                      onPressed: () {
                        Navigator.pop(context);
                      },
                    )
                  ),
                );
              }
            );
        }),
      )
    );
  }
}